unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Registry;

type
  TForm1 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
    reg : Tregistry;
     NumPDV, Porta: string;
     PDV : smallint;
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}
{$R \projetos\MyUAC.res}

procedure TForm1.Button1Click(Sender: TObject);
begin
    try
      reg := TRegistry.Create;
      reg.RootKey := HKEY_LOCAL_MACHINE;
      reg.OpenKey('\SOFTWARE\SOFTWAREG',false);
      Porta := reg.ReadString('Impressora');
      NumPDV := Reg.ReadString('PDV');
      Application.MessageBox(PwideChar('Conteudo do registro NumPDV='+NumPDV+' Porta='+Porta), 'Aviso', MB_OK);
    except
    on Erro: Exception do
      Application.ShowException(Erro);
    end;

    reg.Free;
end;

end.


